package com.atguigu.spzx.common.service.exception;

import com.atguigu.spzx.model.vo.common.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName: GlobaExceptionHandler
 * @Package: com.atguigu.spzx.common.service.exception
 * @Description 处理自定义异常与系统异常类
 * @Author 孤妤
 * @Date: 2023/12/3 15:57
 */
@RestControllerAdvice
public class GlobaExceptionHandler {
    @ExceptionHandler(value = GuiguException.class)
    public Result guiguExceptionHandler(GuiguException e){
        e.printStackTrace();
        return Result.build(null,e.getCode(),e.getMessage());
    }
    @ExceptionHandler(value = Exception.class)
    public Result systemExceptionHandler(Exception e) {
        e.printStackTrace();
        return Result.build(null,444,e.getMessage());
    }
}
